import type { LoginResult, UserInfoResult } from '@/api/model/authModel'
import { request } from '@/utils/request/index';
const Api = {
  Login: '/auth/login',
  UserInfo: '/auth/info',
  Logout: '/auth/logout'
}

// 登录接口
export function login(data: { username: unknown; password: unknown }) {
  return request.post<LoginResult>({
    url: Api.Login,
    data
  })
}

// 获取用户信息
export function getUserInfo() {
  return request.get<UserInfoResult>({
    url: Api.UserInfo
  })
}

// 登出接口
export function logout() {
  return request.post<void>({
    url: Api.Logout
  })
}
